﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using PPAP.BO;

namespace PPAP.Web.Todolist
{
    public partial class SampleCard : PageBase
    {
        SamplecardBO sbo = new SamplecardBO();
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadData();
        }

        private void LoadData()
        {
            DataSet ds = sbo.GetListForUser(CurrentUser.Id); //sbo.GetList(" DEPTREP='" + CurrentUser.Id + "' and( s.status=0 or s.status=2) ");
            AspNetPager2.RecordCount = ds.Tables[0].Rows.Count;
            dgList.DataSource = GetPageTable(ds.Tables[0], AspNetPager2.PageSize, AspNetPager2.CurrentPageIndex);
            dgList.DataBind();
        }

        protected void AspNetPager2_PageChanged(object sender, EventArgs e)
        {
            LoadData();
        }

        public string Status(string status)
        {
            string font = "";
            switch (status)
            {
                case "0":
                    font = "Created";
                    break;
                case "1":
                    font = "Circulating";
                    break;
                case "2":
                    font = "Circulating(<font color='red'>Reject</font>)";
                    break;
                default:
                    font = "Decided";
                    break;
            }
            return font;

        }
    }
}